forum

home / developersection / forums / what is dataannotations in mvc?

What is DataAnnotations in mvc?

Anonymous User 2262 09-Oct-2014
Here is a class "Cars" and I have 2 attributs (min/max CO2).
public class Cars
        {
            [Range("MinCO2", int.MaxValue, ErrorMessage = "MaxCO2 < MinCO2")]
            public int MaxCO2 { get; set; }
            [Range(0, "MaxCO2", ErrorMessage = "MaxCO2 > MinCO2")]
            public int MinCO2 { get; set; }
        }

I use the Data Annotation 'Range' to fix the minimum and the maximum value.

But I want to use the car's attribut to fix the minimum or the maximum value.

Or if there is another solution with jQuery, it can be possible.


Updated on 09-Oct-2014

I am a content writter !


Message
Can you answer this question?

Answer

1 Answers

Liked By